Skip to content

Conversation

@sklaha
Copy link
Contributor

@sklaha sklaha commented Oct 23, 2025

Changes in the PR:

  • An integration test (BulkReaderTokenRangeReplicasTest.java) has been added to demonstrate that the replicas for token range calculation were incorrect in CassandraRing with NetworkAwareReplication strategy in a multi-DC, multi-rack scenario.
  • The sidecar token-range-replicas API has been utilized to retrieve replicas for token ranges, eliminating the need for token range calculation within the analytics-library.
  • Unit tests have been added to further validate the changes.

return new long[]{h1, h2};
}

protected static long invRShiftXor(long value, int shift)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are those new methods added?

Comment on lines +106 to +118
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
this.token = in.readUTF();
this.node = in.readUTF();
this.dataCenter = in.readUTF();
}

private void writeObject(ObjectOutputStream out) throws IOException
{
out.writeUTF(token());
out.writeUTF(nodeName());
out.writeUTF(dataCenter());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why adding the custom serialization code? The string fields should be serializable by default, and the readObject & writeObject methods are unnecessary.

Comment on lines -37 to +42
private final String token;
private final String node;
private final String dataCenter;
private String token;
private String node;
private String dataCenter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once readObject & writeObject are removed, the final modifiers can be restored.

Comment on lines +77 to 78
private transient RangeMap<BigInteger, List<CassandraInstance>> replicasForRanges;
private transient RangeMap<BigInteger, List<CassandraInstance>> replicas;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is confusing to have 2 maps and they actually point to the same object if I am not mistaken.
More importantly, it leads to different init code paths. The patch is to fix the broken token calculation, but why leaving it half-fixed? The CDC code patch still calls the original constructor, which means CDC is still broken.

Comment on lines +152 to +153
//updateInternal(1, key, VALUE2);
//expectedValuesInNodes.put(1, VALUE2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are those 2 lines wanted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants